<template>
  <div>
    <h3 class="my-8">{{ $t('educationTiming') }}</h3>

    <v-card class="parameters-page-card">
      <UiFormEdition
        :model="EducationTiming"
        go-back-route="/parameters/education_timings"
      >
        <template #default="{ entity }">
          <UiInputNumber
            v-model="entity.timing"
            field="educationTiming"
            :rules="rules()"
          />
        </template>
      </UiFormEdition>
    </v-card>
  </div>
</template>
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import EducationTiming from '~/models/Education/EducationTiming'

const i18n = useI18n()

const rules = () => [
  (timing: string | null) =>
    (timing !== null && parseInt(timing) > 0) || i18n.t('please_enter_a_value'),
]
</script>
